# -*-coding: Utf-8 -*-
# @File : user_register_task .py
# author: Chimengmeng
# blog_url : https://www.cnblogs.com/dream-ze/
# Time：2024/7/3

from celery_task.celery import app
import redis_lock


@app.task
def user_register(request, username):
    lock = redis_lock.Lock(request.redis_conn, "user_register_lock")
    if lock.acquire(blocking=False):
        print(f"{username} 注册成功")
        lock.release()
    else:
        print(f"{username} 注册失败")
